#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;


struct edge{
	int x,y,l;
};


bool cmp(edge a,edge b){
	return a.l<b.l;
}


int find(int x,int *f){
	if(f[x] == x)
		return x;
	return find(f[x],f);
}



int main(){
	int ans=0;
	int n,m,k;
	cin>>n>>m>>k;
	edge a[m];
	for(int i=0;i<m;i++){
		cin>>a[i].x>>a[i].y>>a[i].l;
		a[i].x--;
		a[i].y--;
	}
	
	
	int f[n];
	for(int i=0;i<n;i++){
		f[i] = i;
	}
	
	
	sort(a,a+m,cmp);
	
	
	for(int i=0;i<m;i++){
		if(n-k <= 0)
			break;
		int x,y,l;
		x = a[i].x;
		y = a[i].y;
		l = a[i].l;
		int fx=find(x,f),fy=find(y,f);
		if(fx == fy)
			continue;
		f[fy] = fx;
		ans += l;
		n--;
	}
	
	
	if(n-k > 0)
		cout<<"No Answer";
	else
		cout<<ans;
	return 0;
}


/*

5 7 2
1 2 5
1 3 4
1 4 5
1 5 3
2 3 5
1 1 0
3 4 2

*/
